package cn.harry.modular.society.controller;

import cn.harry.common.api.R;
import cn.harry.modular.society.service.HuiyuanyonghuService;
import cn.harry.modular.society.service.HuodongshenqingService;
import cn.harry.modular.society.vo.EchartsOptionVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author harry
 * @公众号 Harry技术
 */
@Tag(name = "报表接口")
@RestController
@RequestMapping("/home")
@RequiredArgsConstructor
public class IndexController {

    private final HuiyuanyonghuService huiyuanyonghuService;
    private final HuodongshenqingService huodongshenqingService;

//    各地区会员用饼状图，各分类会员用柱状图，各种活动参加的人数用柱状图


    @Operation(summary = "各地区会员饼状图")
    @GetMapping("/getMemberCount")
    public R<List<Map<String, Object>>> getMemberCount() {
        List<Map<String, Object>> list = huiyuanyonghuService.getMemberCount();
        return R.success(list);
    }

    @Operation(summary = "各分类会员柱状图")
    @GetMapping("/getMemberCountByType")
    public R<EchartsOptionVO> getMemberCountByType() {
        return R.success(huiyuanyonghuService.getMemberCountByType());
    }

    @Operation(summary = "各种活动参加的人数柱状图")
    @GetMapping("/getHuodongUser")
    public R<EchartsOptionVO> getHuodongUser() {
        return R.success(huodongshenqingService.getHuodongUser());
    }
    @Operation(summary = "各分类会员饼图")
    @GetMapping("/getMemberCountByTypePie")
    public R<List<Map<String, Object>>> getMemberCountByTypePie() {
        return R.success(huiyuanyonghuService.getMemberCountByTypePie());
    }

}
